package com.zqj.project.factory;

import com.zqj.project.common.database.mybatis.conditions.Wraps;
import com.zqj.project.common.database.mybatis.conditions.query.LbqWrapper;
import com.zqj.project.entity.OrderPO;
import com.zqj.project.model.Order;

import java.util.Objects;

/**
 * @Description: OrderFactory
 * @Author: 22001010704 Zhang Qijian
 * @CreateTime: 2024/12/8 18:53
 * @Version: 1.0
 */
public class OrderFactory {

    private OrderFactory() {
        throw new IllegalStateException("Utility Class");
    }

    public static LbqWrapper<OrderPO> lbqWrapper(Order order) {
        return Wraps.<OrderPO>lbQ().eq(Objects.nonNull(order.getUserId()),
                OrderPO::getUserId, order.getUserId()).eq(Objects.nonNull(order.getStatus()),
                OrderPO::getStatus, order.getStatus()).orderByDesc(OrderPO::getCreateTime);
    }

}